package GUI;

import java.util.Comparator;
import java.util.Map;

public class MonthYearComparator implements Comparator<Object> {

	
		
	@Override
	public int compare(Object arg0, Object arg1) {
		String key1=(String) arg0;
		String key2=(String) arg1;
		String key1Parts[]=key1.split("/");
		String key2Parts[]=key1.split("/");
		int yearKey1=Integer.parseInt(key1Parts[1]);
		int monthKey1=Integer.parseInt(key1Parts[0]);
		int yearKey2=Integer.parseInt(key2Parts[1]);
		int monthKey2=Integer.parseInt(key2Parts[0]);
		if(yearKey1<=yearKey2)
		{
			if(monthKey1<=monthKey2)
			{
				return 1;
			}
			else
			{
				return -1;
			}
		}
		else
		{
			if(monthKey1<=monthKey2)
			{
				return 1;
			}
			else{
				return -1;
			}
		}
		
	}
	

}
